﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeCubicSplineCurve2d : OdGeSplineEnt2d
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeCubicSplineCurve2d(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGeCubicSplineCurve2d_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeCubicSplineCurve2d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeCubicSplineCurve2d()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeCubicSplineCurve2d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGeCubicSplineCurve2d() : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGeCubicSplineCurve2d source) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_1(OdGeCubicSplineCurve2d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGePoint2dArray fitPnts, OdGeTol tol) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_2(OdGePoint2dArray.getCPtr(fitPnts).Handle, OdGeTol.getCPtr(tol)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGePoint2dArray fitPnts) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_3(OdGePoint2dArray.getCPtr(fitPnts).Handle), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGePoint2dArray fitPnts, OdGeVector2d startDeriv, OdGeVector2d endDeriv, OdGeTol tol) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_4(OdGePoint2dArray.getCPtr(fitPnts).Handle, OdGeVector2d.getCPtr(startDeriv).Handle, OdGeVector2d.getCPtr(endDeriv).Handle, OdGeTol.getCPtr(tol)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGePoint2dArray fitPnts, OdGeVector2d startDeriv, OdGeVector2d endDeriv) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_5(OdGePoint2dArray.getCPtr(fitPnts).Handle, OdGeVector2d.getCPtr(startDeriv).Handle, OdGeVector2d.getCPtr(endDeriv).Handle), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGeCurve2d curve, double tol) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_6(OdGeCurve2d.getCPtr(curve), tol), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGeKnotVector knots, OdGePoint2dArray fitPnts, OdGeVector2dArray firstDerivs, bool isPeriodic) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_7(OdGeKnotVector.getCPtr(knots), OdGePoint2dArray.getCPtr(fitPnts).Handle, OdGeVector2dArray.getCPtr(firstDerivs), isPeriodic), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeCubicSplineCurve2d(OdGeKnotVector knots, OdGePoint2dArray fitPnts, OdGeVector2dArray firstDerivs) : this(GlobalsPINVOKE.new_OdGeCubicSplineCurve2d__SWIG_8(OdGeKnotVector.getCPtr(knots), OdGePoint2dArray.getCPtr(fitPnts).Handle, OdGeVector2dArray.getCPtr(firstDerivs)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public int numFitPoints()
		{
			int result = GlobalsPINVOKE.OdGeCubicSplineCurve2d_numFitPoints(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint2d fitPointAt(int fitPointIndex)
		{
			OdGePoint2d result = new OdGePoint2d(GlobalsPINVOKE.OdGeCubicSplineCurve2d_fitPointAt(this.swigCPtr, fitPointIndex), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeCubicSplineCurve2d setFitPointAt(int fitPointIndex, OdGePoint2d point)
		{
			OdGeCubicSplineCurve2d result = new OdGeCubicSplineCurve2d(GlobalsPINVOKE.OdGeCubicSplineCurve2d_setFitPointAt(this.swigCPtr, fitPointIndex, OdGePoint2d.getCPtr(point)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeVector2d firstDerivAt(int fitPointIndex)
		{
			OdGeVector2d result = new OdGeVector2d(GlobalsPINVOKE.OdGeCubicSplineCurve2d_firstDerivAt(this.swigCPtr, fitPointIndex), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeCubicSplineCurve2d setFirstDerivAt(int fitPointIndex, OdGeVector2d deriv)
		{
			OdGeCubicSplineCurve2d result = new OdGeCubicSplineCurve2d(GlobalsPINVOKE.OdGeCubicSplineCurve2d_setFirstDerivAt(this.swigCPtr, fitPointIndex, OdGeVector2d.getCPtr(deriv).Handle), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeCubicSplineCurve2d Assign(OdGeCubicSplineCurve2d spline)
		{
			OdGeCubicSplineCurve2d result = new OdGeCubicSplineCurve2d(GlobalsPINVOKE.OdGeCubicSplineCurve2d_Assign(this.swigCPtr, OdGeCubicSplineCurve2d.getCPtr(spline)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
